home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Info 1994 March
/
Internet Info CD-ROM (Walnut Creek) (March 1994).iso
/
networking
/
ip
/
ka9q
/
src890906.arc
/
UDP.H
< prev
next >
Wrap
C/C++ Source or Header
|
1989-09-07
|
2KB
|
65 lines
#ifndef NUDP
#include "global.h"
#include "netuser.h"
/* User Datagram Protocol definitions */
#define NUDP 20
/* Structure of a UDP protocol header */
struct udp {
int16 source; /* Source port */
int16 dest; /* Destination port */
int16 length; /* Length of header and data */
int16 checksum; /* Checksum over pseudo-header, header and data */
};
#define UDPHDR 8 /* Length of UDP header */
/* User Datagram Protocol control block
* Each entry on the receive queue consists of the
* remote socket structure, followed by any data
*/
struct udp_cb {
struct udp_cb *prev; /* Linked list pointers */
struct udp_cb *next;
struct socket socket; /* Local port accepting datagrams */
void (*r_upcall) __ARGS((struct iface *iface,struct udp_cb *,int));
/* Function to call when one arrives */
struct mbuf *rcvq; /* Queue of pending datagrams */
int rcvcnt; /* Count of pending datagrams */
int user; /* User link */
};
extern struct udp_cb *Udps[]; /* Hash table for UDP structures */
#define NULLUDP (struct udp_cb *)0
/* UDP statistics counters */
struct udp_stat {
int16 rcvd; /* Packets received */
int16 sent; /* Packets sent */
int16 cksum; /* Checksum errors */
int16 unknown; /* Unknown socket */
int16 bdcsts; /* Incoming broadcasts */
};
extern struct udp_stat Udp_stat;
/* UDP primitives */
/* In udp.c: */
int del_udp __ARGS((struct udp_cb *up));
struct mbuf *htonudp __ARGS((struct udp *udp,struct mbuf *data,struct pseudo_header *ph));
int ntohudp __ARGS((struct udp *udp,struct mbuf **bpp));
struct udp_cb *open_udp __ARGS((struct socket *lsocket,
void (*r_upcall) __ARGS((struct iface *iface,struct udp_cb *,int))));
int recv_udp __ARGS((struct udp_cb *up,struct socket *fsocket,struct mbuf **bp));
int send_udp __ARGS((struct socket *lsocket,struct socket *fsocket,char tos,
char ttl,struct mbuf *data,int16 length,int16 id,char df));
void udp_input __ARGS((struct iface *iface,struct mbuf *bp,struct ip *ip,
int rxbroadcast));
/* In udpcmd.c: */
void st_udp __ARGS((struct udp_cb *udp,int n));
#endif /* NUDP */